import './assets/main.css'
import { createApp } from 'vue'
//引入子应用
import App from './App.vue'
import './public-path'
import { renderWithQiankun, qiankunWindow }  from 'vite-plugin-qiankun/dist/helper'
let instance = null
function render(props = {}) {
    const {container} = props 
    instance = createApp(App)
    instance.mount(container ? container.querySelector('#app') : '#app');
}
// 如何独立运行微应用？
if (!qiankunWindow.__POWERED_BY_QIANKUN__) {
    render()
  } else {
    renderWithQiankun({
      mount(props) {
        render(props)
      },
      bootstrap() {
        console.log('vue app bootstraped');
      },
      unmount(props) {
        instance.unmount(props)
        instance = null
      },
      update(props) {
        console.log('update props', props);
      }
    })
  }
  